auto.waitFor();

var width = device.width;
var height = device.height
setScreenMetrics(width, height);
var myFunc = require("myCommonFunction.js");


var ret = myFunc.initNetWork(null, false);


opreateApp();


function opreateApp() {
    try {
        myFunc.openMyApp("招商银行");
        sleep(800);
        myFunc.textpClick("我的", 5000);
        // text("我的").findOne(5000).parent().click();
        sleep(800);
        gestures([500, [316, 1911], [725, 1911]],
            [1000, [725, 1911], [1122, 1538]],
            [1500, [1122, 1538], [725, 1538]]);
        sleep(2000);
        myFunc.textpClick("积分", 5000);
        // text("积分").findOne(5000).parent().click();
        sleep(800);
        myFunc.textpClick("签到", 5000);

        var a = className("android.widget.Button").text("开心收下").findOne(3000);
        if(a != null) {
            a.click();
        }

        // text("签到").findOne(5000).parent().parent().click();
        myFunc.textpClick("签到领积分", 5000);

        // text("签到领积分").findOne(5000).parent().click();
        myFunc.tuichu("招商银行");
    } catch (error) {
        log(error);
        myFunc.tuichu("招商银行");
        opreateApp();
    }


}
